package com.jrfid.smartcabinet.demo

import android.app.Application
import android.graphics.Color
import android.view.Gravity
import com.blankj.utilcode.util.CrashUtils
import com.blankj.utilcode.util.LogUtils
import com.blankj.utilcode.util.SizeUtils
import com.blankj.utilcode.util.ToastUtils
import com.blankj.utilcode.util.Utils
import kotlin.properties.Delegates

class App : Application() {

    companion object {
        var instance: App by Delegates.notNull()

        fun instance() = instance
    }

    override fun onCreate() {
        super.onCreate()
        instance = this
        Utils.init(this)
        LogUtils.getConfig().isLogSwitch = true
        externalCacheDir?.let {
            CrashUtils.init(it)
        }
        ToastUtils.getDefaultMaker().setBgResource(R.drawable.shape_toast_bg).setGravity(Gravity.CENTER, 0, SizeUtils.dp2px(200f)).setTextColor(Color.WHITE)
    }

}